<?php

namespace app\admin\model\sand_manager;

use think\Model;


class SandPic extends Model
{

    

    

    // 表名
    protected $name = 'sand_pic';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'merchant_type_text',
        'liquidation_mode_text',
        'enterprise_nature_text',
        'business_license_type_text',
        'license_validity_type_text',
        'legal_person_card_type_text',
        'contact_person_type_text',
        'pay_way_text',
        'status_text'
    ];
    

    
    public function getMerchantTypeList()
    {
        return ['GENERAL_MERCHANT' => __('普通商户')];
    }

    public function getLiquidationModeList()
    {
        return ['T1' => __('T1')];
    }

    public function getEnterpriseNatureList()
    {
        return ['OTHER' => __('其他组织'), 'GOVERNMENT_INSTITUTION' => __('事业单位'), 'INDIVIDUAL_BUSINESS' => __('个体工商户'), 'LIMITED_COMPANY' => __('有限公司'), 'STOCK_COMPANY' => __('股份公司')];
    }

    public function getBusinessLicenseTypeList()
    {
        return ['NATIONAL_LEGAL_MERGE' => __('统一社会信用代码'), 'NATIONAL_LEGAL' => __('营业执照')];
    }

    public function getLicenseValidityTypeList()
    {
        return ['CHOOSE_DATE' => __('选择日期'), 'LONG_DATE' => __('长期')];
    }

    public function getLegalPersonCardTypeList()
    {
        return ['5' => __('其他'), '4' => __('台湾居民来往内地通行证'), '3' => __('港澳居民来往内地通行证'), '2' => __('护照'), '1' => __('身份证')];
    }

    public function getContactPersonTypeList()
    {
        return ['OTHER' => __('其他'), 'AGENT' => __('代理人'), 'CONTROLLER' => __('控制人'), 'LEGAL_PERSON' => __('法人代表')];
    }

    public function getPayWayList()
    {
        return ['SANDBAO' => __('杉德宝'), 'UNION_PAY' => __('银联支付'), 'ALIPAY' => __('支付宝'), 'WEIXIN' => __('微信')];
    }

    public function getStatusList()
    {
        return ['RISK' => __('Risk'), 'UNAPPROVE' => __('Unapprove'), 'UNACTIVE' => __('Unactive'), 'ACTIVE' => __('Active'), 'FIRSTPASS' => __('Firstpass'), 'UNDERAPPROVAL' => __('Underapproval'), 'BUSIAPPROVAL' => __('Busiapproval'), 'CREATED' => __('Created')];
    }


    public function getMerchantTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['merchant_type']) ? $data['merchant_type'] : '');
        $list = $this->getMerchantTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getLiquidationModeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['liquidation_mode']) ? $data['liquidation_mode'] : '');
        $list = $this->getLiquidationModeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getEnterpriseNatureTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['enterprise_nature']) ? $data['enterprise_nature'] : '');
        $list = $this->getEnterpriseNatureList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getBusinessLicenseTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['business_license_type']) ? $data['business_license_type'] : '');
        $list = $this->getBusinessLicenseTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getLicenseValidityTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['license_validity_type']) ? $data['license_validity_type'] : '');
        $list = $this->getLicenseValidityTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getLegalPersonCardTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['legal_person_card_type']) ? $data['legal_person_card_type'] : '');
        $list = $this->getLegalPersonCardTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getContactPersonTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['contact_person_type']) ? $data['contact_person_type'] : '');
        $list = $this->getContactPersonTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getPayWayTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['pay_way']) ? $data['pay_way'] : '');
        $list = $this->getPayWayList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
